package org.liuyunfeng.consumer;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author: TanJingyu
 * @create: 2022-07-11 17:01
 **/
@Component
public class TestConsumer {
    private final AtomicInteger count = new AtomicInteger();

//    @RabbitListener(id = "manual.acks.hello", queues = "test", ackMode = "AUTO", concurrency = "1-5")
    @RabbitListener(id = "manual.acks.hello", queues = "test", ackMode = "MANUAL")
    public void handleMes(Object o, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) throws IOException, InterruptedException {
//        System.out.println("当前线程：" + Thread.currentThread().getName() + "   当前信道" + channel + "    当前收到的消息：" + tag);
//        TimeUnit.SECONDS.sleep(2);
        channel.basicRecover()
        int i = 1 / 0;
    }
}

    